Current Location: Home> Function Categories> timezone_offset_get

timezone_offset_get

Alias ​​for DateTimeZone::getOffset - Returns the time difference relative to GMT
Name:timezone_offset_get
Category:Date and time
Programming Language:php
One-line Description:Returns the time zone offset relative to GMT.

Definition and usage

timezone_offset_get() returns the timezone offset relative to GMT.

Example

Returns the time zone offset relative to GMT:

 <?php
$tz = timezone_open ( "Asia/Taipei" ) ;
$dateTimeNY = date_create ( "now" , timezone_open ( "America/New_York" ) ) ;
echo timezone_offset_get ( $tz , $dateTimeNY ) ;
?>

Try it yourself

grammar

 timezone_offset_get ( object , datetime ) ;
parameter describe
object Required. Specifies the DateTimeZone object returned by timezone_open() .
datetime Required. Specifies the date/time to which the offset needs to be calculated.
Similar Functions
Popular Articles